package com.cloud.pole.rpc;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.cloud.pole.api.shop.ShopShopsViewApi;
import com.cloud.pole.api.weixin.WxUserApi;
import com.cloud.pole.common.constant.CommonConstants;
import com.cloud.pole.common.exception.BaseException;
import com.cloud.pole.common.exception.ParamException;
import com.cloud.pole.common.msg.ApiRestResponse;
import com.cloud.pole.tool.service.ExpressService;
import com.cloud.pole.tool.service.FileUploadService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestController
@RequestMapping("api/express")
public class ExpressRest {

    @Autowired
    private ExpressService expressService;
    
    @RequestMapping(value = "/kdi", method = RequestMethod.GET)
    public ApiRestResponse<String> kdi(
  		  @RequestParam(name="no", defaultValue = "") String no,
  		  @RequestParam(name="type", defaultValue = "") String type){
		try {
			ParamException.err(StringUtils.isBlank(no), "no不能为空");
			return ApiRestResponse.success(CommonConstants.STATUS_OK_MESSAGE, expressService.kdi(no, type));
		} catch (BaseException e) {
			return ApiRestResponse.fail(e.getStatus(), e.getMessage(), null);
		} catch (Exception e) {
			log.error(CommonConstants.STATUS_ERROR_MESSAGE + "{}", e.getMessage(), e);
			return ApiRestResponse.fail(CommonConstants.STATUS_ERROR_MESSAGE, null);
		}
    }
}
